import {httpDelete, httpGet, httpPageableGet, httpPost, httpPut} from '@/utils/request'


export async function findOne( id:any ){
  const { data }  = await httpGet(`/api/v1/alarm-rule/findOne/${id}` )
  return data;
}

export async function findAlarmRules( params?:any ){
  const { data,total }  = await httpPageableGet('/api/v1/alarm-rule/find-alarm-rules',params)
  return { data,total };
}

export async function modify( params?:any ){
  const { code }  = await httpPut('/api/v1/alarm-rule/modify',params)
  return code === 200;
}

export async function statusByRule( params?:any ){
  const { code }  = await httpPut('/api/v1/alarm-rule/status-by-rule-ids',params)
  return code === 200;
}

export async function statusByPipelineId( params?:any ){
  const { code }  = await httpPut('/api/v1/alarm-rule/status-by-pipeline-id',params)
  return code === 200;
}

export async function modifyStatus( params?:any ){
  const { code }  = await httpPut('/api/v1/alarm-rule/modify-status',params)
  return code === 200;
}

export async function oneKeyAddMonitor( pipelineId:any ){
  const { code }  = await httpPost(`/api/v1/alarm-rule/one-key-create-monitor/${pipelineId}` )
  return code === 200;
}

export async function create( params?:any ){
  const { code }  = await httpPost('/api/v1/alarm-rule/create',params)
  return code === 200;
}

export async function oneKeyMonitor( params?:any ){
  const { code }  = await httpPost('/api/v1/alarm-rule/one-key-monitor',params)
  return code === 200;
}

export async function deleteById( alarmRuleId:any ){
  const { code }  = await httpDelete(`/api/v1/alarm-rule/delete/${alarmRuleId}` )
  return code === 200;
}

